home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.teleport.com!usenet
- From: GHouck <hksys@teleport.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Arrow keys in DOS
- Date: 22 Feb 1996 01:06:02 GMT
- Organization: systems hk
- Message-ID: <4ggfhq$qnh@maureen.teleport.com>
- References: <312A7CDB.7010@wolfenet.com>
- NNTP-Posting-Host: ip-pdx12-38.teleport.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
-
- Michael Gooding <mgooding@wolfenet.com> wrote:
- >How would one go about trapping and interpreting arrow keys in a DOS
- >program written in BC++ 4.5
-
- Michael,
-
- I use this little program any time I want to determine a key's
- value. It dumps the multi-byte values for the arrow-keys as
- well: It is DOS and Borland-specific.
-
- Yours, Geoff Houck
- /* ----------------------------------------------------
- key.c -- display key values (until ESC is hit)
- ---------------------------------------------------- */
- int main ( void )
- {
- int chr = 0;
- int last = 0;
-
- while( chr != 27 ) { /* loop until an ESC */
- if( kbhit() ) { /* key pressed? */
- chr = getch(); /* get the key */
- if( last == 0 ) /* multi-scan code ? */
- printf( " <%c> %3u.d %2X.x %03o.o",chr,chr,chr,chr );
- else
- printf( "\n<%c> %3u.d %2X.x %03o.o",chr,chr,chr,chr );
- last = chr;
- }
- }
- }
-
-
-